class Animal:
    name = "abc"
    def get_name():
        print(name)


    def say(name):
        # 这里是形参name，和其他无关
        print(name)

"""
Traceback (most recent call last):
    ...
    Animal.get_name()
    ...
    print(name)
          ^^^^
NameError: name 'name' is not defined
"""
# Animal.get_name()

"""
    用函数形参的形式简接访问类变量
"""
Animal.say(Animal.name)


#*****************************************
class Dog:
    def get_name(self):
        print(self.name)

    def set_name(self,name):
        self.name = name

my_dog = Dog()

my_dog.set_name("hello")
my_dog.get_name()